#define  _CRT_SECURE_NO_WARNINGS


#include<stdio.h>
#include<stdlib.h>

int cmp(const void* e1, const void* e2)
{
	return *(int*)e1 - *(int*)e2;
}
int main()
{
	int n = 0;
	while (scanf("%d", &n) != EOF)
	{
		if (n == 0)
			break;
		int arr[1000] = { 0 }, a[100] = { 0 }, i = 0, j = 0, temp = 0;
		for (i = 0; i < n; i++)
		{
			scanf("%d", &temp);
			if (arr[temp] == 0)
				a[j++] = temp;
			arr[temp] = 1;
		}
		qsort(a, j, sizeof(int), cmp);
		printf("%d\n", j);
		for (i = 0; i < j; i++)
			printf("%d ", a[i]);
		printf("\n\n");
	}

	return 0;
}